<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class HomeLoginPostRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'uname' => 'regex:/\w{3,18}/',
            'upass' => 'regex:/\w{6,18}/',
            'email' => 'email',
            'phone' => 'regex:/\d{7,15}/',
        ];
    }

      /**
     * 自定义验证规则的错误信息
     *
     * @return array
     */
    public function messages()
    {
        return [
            'uname.regex'=>'请输入3到18为的用户名',
            'email.email'=>'邮箱格式不正确',
            'phone.regex'=>'请输入正确格式的手机号',
            'upass.regex'=>'请输入6到18为的密码',
        ];
    }
}
